//
//  PhotoBrowserView.m
//  宜居HD
//
//  Created by 张金国 on 16/5/4.
//  Copyright © 2016年 张金国. All rights reserved.
//

#import "PhotoBrowserView.h"
#import "Masonry.h"
#import "UIColor+RandomColor.h"

@interface PhotoBrowserView ()

//@property (nonatomic ,strong)UICollectionView *collectionView;

@end

@implementation PhotoBrowserView
#pragma mark - init
- (instancetype)init {
    if (self = [super init]) {
        [self setupConstraints];
    }
    return self;
}
#pragma mark - private
- (void)setupConstraints {
    UILabel  *titleLabel = [[UILabel alloc]init];
//    titleLabel.backgroundColor = [UIColor colorWithHexString:@"#901111"];
    titleLabel.text = @" 个人照片";
    [self addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(self).offset(TenOffsetViewMargin);
        make.width.equalTo(self.mas_width).multipliedBy(1/7.0);
        make.height.equalTo(self.mas_height).multipliedBy(1/7.0);
    }];
    [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(titleLabel.mas_top);
        make.left.equalTo(titleLabel.mas_right).offset(TenOffsetViewMargin);
        make.right.equalTo(self.mas_right).offset(-TenOffsetViewMargin);
        make.bottom.equalTo(self.mas_bottom).offset(-TenOffsetViewMargin);
    }];
}
#pragma mark - getters

- (UICollectionView *)collectionView {
    if (!_collectionView) {
      UICollectionViewFlowLayout  *flowLayout =[[UICollectionViewFlowLayout alloc]init];
        flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        _collectionView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:flowLayout];
        _collectionView.backgroundColor = [UIColor whiteColor];
        [self addSubview:_collectionView];
    }
    return _collectionView;
}


@end


